@use "sass:math";

@function strip-units($number) {
	@return math.div($number, ($number * 0 + 1));
}

@mixin maxWidth($width: 768) {
	@if unitless($width) {
		$width: $width * 1px;
	}
	@media all and (max-width: $width) {
		@content;
	}
}

@mixin minWidth($width: 768) {
	@if unitless($width) {
		$width: $width * 1px;
	}
	@media all and (min-width: $width) {
		@content;
	}
}

@function px2vw($px, $width: 768) {
	@if not(unitless($px)) {
		$px: strip-units($px);
	}
	@return math.div($px, $width) * 100vw;
}

@function px2vh($px, $width: 768) {
	@if not(unitless($px)) {
		$px: strip-units($px);
	}
	@return math.div($px, $width) * 100vh;
}
